<?php

if (! defined ( 'BASEPATH' ))
	exit ( 'No direct script access allowed' );
class Test extends CI_Controller {
	function __construct() {
		parent::__construct ();
		$this->load->library ( 'unit_test' );
	}
	public function index() {
		echo '<center><h3>Project Unit Test</h3></center>';
		
		$this->test_Login_model_login ();
	}
	private function test_Login_model_login() {
		$this->load->model ( 'Login_model' );
		
		$testName = 'login name/pwd';
		$testNotes = 'Test login model';
		$test = $this->Login_model->login ( 'user', 'user', '0' );
		echo $this->unit->run ( $test, 'is_true', $testName, $testNotes );
	}
	function test() {
		echo 'BASEPATH: ' . BASEPATH;
		echo '<br>';
		echo 'APPPATH: ' . APPPATH;
		echo '<br>';
		echo 'site_url:' . site_url ();
		$this->load->library ( 'mylang' );
		$this->mylang->setLanguage ( 'en' );
		// $this->mylang->setLanguage2('en');
		$this->mylang->load ( 'admin' );
		$this->load->view ( 'test/test' );
	}
	function pwd() {
		$this->load->helper ( 'myfunc' );
		$userpwd = md5pass ( 'user', 'user' );
		$adminpwd = md5pass ( 'admin', 'admin' );
		echo 'name, pwd';
		echo '<br>';
		echo 'user, ' . $userpwd;
		echo '<br>';
		echo 'admin, ' . $adminpwd;
		echo '<br>';
		echo 'time:' . time ();
	}
	
	/**
	 * 测试controller单例模式： 
	 * 不是单例模式
	 * 每次访问controller都会实例化一个controller
	 */
	private $userId = "0";
	function set() {
		$this->userId = "234";
		var_dump ( $this->userId );
	}
	function get() {
		var_dump ( $this->userId );
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */